package com.chillis.standings.ui.table;

import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;
import com.chillis.standings.R;
import com.chillis.standings.dispatch.TableManager;
import com.chillis.standings.domain.table.Table;

public class TableActivity extends Activity {

   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      setContentView(R.layout.view_table);

      Table table = TableManager.instance().table();

      GridView grid = (GridView) findViewById(R.id.grid);

      if (table.stages().size() == 0) throw new Error("stages count can't be 0");

      grid.setNumColumns(table.stages().size());
      grid.setAdapter(new TableAdapter(this, table));
   }
}
